package com.xm.cloud.rabbitmq.mq;

import com.xm.rabbitmq.dto.UserEvent;
import com.xm.rabbitmq.dto.mq.pipeline.UserEventPipeline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @author 小木
 * @date 2021/4/20
 * @desc 消息-消费者
 */
@Component
@EnableBinding(UserEventPipeline.class)
public class UserEventConsumer {

    private final Logger logger = LoggerFactory.getLogger(UserEventConsumer.class);

    @StreamListener(UserEventPipeline.RECV)
    public void receiver(@Payload UserEvent userEvent) {
        logger.info("============== 消费开始消费 = {}", userEvent);
    }


}
